<!--- daftar konstanta -->
var cDIMGreg = new Array (0,31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
var cDIMArab = new Array (0,30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29);
var cMSGreg = new Array ('Januari','Februari','Maret','April','Mei','Juni','Juli','Agustus','September','Oktober','November','Desember');
var cMSArab = new Array ('Muharam','Safar','Rabiul Awal','Rabiul Akhir','Jumadil Awal','Jumadil Akhir','Rajab','Syaban','Ramadhan','Syawal','Dzulqoidah','Dzulhijah');
var conYA = new Array (0,354,709,1063,1417,1772,2126,2481,2835,3189,3544,3898,4252,4607,4961,5315,5670,6024,6379,6733,7087,7442,7796,8150,8505,8859,9214,9568,9922,10277,10631);
var conDYA= new Array (6503,10631,30,660);
var cLYA= new Array (2,5,7,10,13,16,18,21,24,26,29);

var dDay,dMonth,dYear,tt,Tot,t;
today=new Date();
vyear=today.getFullYear();
vmonth=today.getMonth();
vdate=today.getDate();
LeapY=0;

<!-- fungsi-fungsi --->
function kabisat(yy){
var k 
  if ((yy % 4)!=0) k=0;
  else if ((yy % 100)!=0) k=1;
  else if ((yy % 400)!=0) k=0;
  else k=1;
  return k;
}

function fTotalDay(dd,mm,yy){
var y,m,c;
  var now = new Date();
  var hours = now.getHours();
  if(hours >= 18) dd+=1;
  y=0;
  Tot=(Math.ceil(yy/4))-(Math.ceil(yy/100))+(Math.ceil(yy/400))+yy*365+dd;
  m=0;
  for (c=0;c<=mm-1;c++){
     m=m+cDIMGreg[c];
  }
  Tot=Tot+m-1;
  if ((kabisat(yy)==1)&&(mm==1)||(mm==2)) Tot=Tot-1;
  return Tot;
}

function DayOfYears(dd,mm,yy){
var tY;
  tt=fTotalDay(dd,mm,yy);
  t=(tt+6503)%10631; 
  cY=0;
  tY=0;
  while (t>conYA[cY]){
    tY=t-conYA[cY];
    if(tY<=355) break;
    cY++;
  }
  cY--;
 return tY;
}

function GetDayofYear(dd,mm,yy){
var tY,tD,cM,totY,dM;
var LeapY=0;
  
  tY=DayOfYears(dd,mm,yy);
  for(var i=1;i<=11;i++){
    if(cY==cLYA[i-1]) LeapY=1;
  }
  if(tY==355&&LeapY==0) tY-1;
  cM=0;
  dM=0;
  tD=0;
  while (tY>(dM+cDIMArab[cM])) {
    dM=dM+cDIMArab[cM];
    tD=tY-dM;
    cM=cM+1;
  }
  totY=(Math.ceil((tt+6503)/10631))*30-688+cY;
<!--  dDay=tD;  -->
  dDay=tD-1;
  dMonth=(cM-1);
  dYear=totY //+LeapY;
<!-- new update 13.11.2001 --->
  if(dDay>cDIMArab[dMonth+1]){
	dDay=1;
	dMonth++;
  }
<!-- new update 14.03.2002 --->
  if(dMonth>11){
    dMonth=0;
    dYear++;
  }
  if((dDay>=13)&&(dDay<=15)){
    if(dMonth==8){
      document.writeln(dDay+' '+cMSArab[dMonth]+' '+dYear+' H');}
    else{
      document.writeln('<b><font color=red>Ayamul Bidh : '+dDay+' '+cMSArab[dMonth]+' '+dYear+' H</b></font>');}
  }
  else
    document.writeln(dDay+' '+cMSArab[dMonth]+' '+dYear+' H');
}
<!-- new update 13.11.2001 --->
GetDayofYear(parseInt(today.getDate()+0),parseInt(today.getMonth()+1),parseInt(today.getFullYear()));

//---- akhir source code -->